package com.job.sun.HomeWork0715;

/**
 * @author 张春阳
 * @version 1.0
 * @since 2022-07-18 14:16:29
 */
public class StriingConstructor {
    public static void main(String[] args) {
        String name1 = "lucy", name2 = "luck";
        System.out.println(name1.compareTo(name2));
        System.out.println("luc".compareTo(name2));
        System.out.println("luck".compareTo(name2));

        String s1 = new String(new char[]{'A', '1', '!'});
        s1 = s1 + name1;
        System.out.println(s1);
        s1 = s1.concat("1999");
        System.out.println(s1);

        String ss1 = "https://www.sfdsfds26vd_sou7162c4775f0c";
        System.out.println(ss1.contains("bilibili"));

        String ss2 = "https//www.baidu/dfghdfgfdbvm.jpg";
        System.out.println(ss2.endsWith(".jpg"));
        System.out.println(ss2.startsWith("https"));
        String ss3 = "https//www.baidu.com/baidu%IJIjdwdjwddasdnifjfa]";
        System.out.println(ss3.indexOf("baidu"));
        System.out.println(ss3.indexOf("baidu", 12 + "baidu".length()));

        String ss = "ahellobhellochellodhelloehellohhello";
        int index = -1, findStartIndex = 0, counts = 0;
        String find = "hello";
        while ((index = ss.indexOf(find, findStartIndex)) != -1) {
            counts++;
            findStartIndex = index + "hello".length();
        }
        System.out.println(counts);
    }
}